package com.lkl.hystrixdemo.order.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogAspect {

    private static final String POINT_CUT = "@annotation(com.lkl.hystrixdemo.order.aspect.annotation.LklLogAnnotation)";

    @Pointcut(value = POINT_CUT)
    public void pointCut () {

    }

    @Around(value = "pointCut()")
    public Object around (ProceedingJoinPoint point) throws Throwable {

        Object[] objs = point.getArgs();

        for (Object obj : objs) {
            System.out.println("请求的参数是："  + obj);
        }
        Object res = point.proceed();
        System.out.println("执行的结果是：" + res.toString());
        return res;
    }

}
